<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="/MES_Project/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
function buy(){
	var form = document.send;
	if(isNaN(form.plasticF.value) || isNaN(form.chipset.value) || isNaN(form.plasticB.value) || isNaN(form.lcd.value) || isNaN(form.board.value) || isNaN(form.battery.value)){
		alert("숫자만 입력해주세요");
		return false;
	}else{
		var queryString = "plasticF="+$("#plasticF").val()+"&lcd="+$("#lcd").val()+"&chipset="+$("#chipset").val()
		+"&board="+$("#board").val()+"&plasticB="+$("#plasticB").val()+"&battery="+$("#battery").val();
		$("#send").attr("action", "/${initParam.context_root }/buy.do?queryString").submit();
		
	}
}

function resetText(txt){
	txt.value="";
}
</script>
<body>
<form name="send" id="send" method="post">
<table>
	<tr>
		<td colspan="2">기계A</td>
		<td colspan="2">기계B</td>
		<td colspan="2">기계C</td>
	</tr>
	<tr>		
		<td>부품A : </td><td><input type="text" name="plasticF" id="plasticF" size="4" value="0" onfocus="resetText(this)"> &nbsp;&nbsp;</td>
		<td>부품C : </td><td><input type="text" name="chipset" id="chipset" size="4" value="0" onfocus="resetText(this)"> &nbsp;&nbsp;</td>
		<td>부품E : </td><td><input type="text" name="plasticB" id="plasticB" size="4" value="0" onfocus="resetText(this)"> &nbsp;&nbsp;</td>
	</tr>
	<tr>
		<td>부품B : </td><td><input type="text" name="lcd" id="lcd" size="4" value="0" onfocus="resetText(this)"></td>
		<td>부품D : </td><td><input type="text" name="board" id="board" size="4" value="0" onfocus="resetText(this)"></td>
		<td>부품F : </td><td> <input type="text" name="battery" id="battery" size="4" value="0" onfocus="resetText(this)"></td>
	</tr>
	<tr>
		<td colspan="3"><input type="button" value="주문" onclick="return buy()"></td>
	</tr>
</table>
</form>
</body>
</html>